using Engine;
using Game;
using GameEntitySystem;

namespace SCIENEW {
    public class HearthFurnaceInputPortDevice : FourDirectionalDevice, IFluidTransferrerDevice {
        public HearthFurnaceInputPortDevice() : base("HearthFurnaceInputPortDevice", 231, 231, 4, upSlot: 4, downSlot: 4) {
        }

        public override string GetSoundMaterialName(SubsystemTerrain subsystemTerrain, int value) => "Stone";

        public FluidTransferrer? CreateFluidTransferrer(SubsystemFluidTransfer subsystemFluidTransfer, SubsystemTerrain subsystemTerrain, int value, Point3 point) => new HearthFurnaceInputPortTransferrer(point, subsystemTerrain);

        public FluidConnector? GetConnector(SubsystemTerrain terrain, int value, int face, int x, int y, int z) {
            if (face == GetDirection(value)) return new FluidConnector(new CellFace(x, y, z, face), FluidConnectorType.Input, 1);
            if (face == CellFace.OppositeFace(GetDirection(value))) return new FluidConnector(new CellFace(x, y, z, face), FluidConnectorType.Input, 1);
            return null;
        }

        public override DeviceBehavior[] GetBehaviors(Project project) => [new FluidTransferrerDeviceBehavior(project)];
    }
}